<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%
String path = request.getContextPath();
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<%@ include file="/pages/login/common.jsp" %>
<meta http-equiv="X-UA-Compatible" content="IE=8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta content="B2B电商平台" name="description"/>
<meta content="B2B电商平台" name="keyword"/>

<title>B2B电商平台.店铺维护</title>
<link rel="stylesheet" type="text/css" href="<%=path %>/include/css/style.css" />
<link rel="stylesheet" type="text/css" href="<%=path %>/include/css/btn.css" />
<link rel="stylesheet" type="text/css" href="<%=path %>/include/css/themes.css" />
<link rel="stylesheet" href="<%=path%>/include/JQuery zTree v3.4/css/demo.css">
<link rel="stylesheet" href="<%=path%>/include/JQuery zTree v3.4/css/zTreeStyle/zTreeStyle.css">
<link rel="stylesheet" type="text/css" href="<%=path %>/include/css/register_icss.css" />
<link rel="stylesheet" type="text/css" href="<%=path %>/include/sweetalert/sweetalert.css" />
<link rel="stylesheet" type="text/css" href="<%=path %>/include/css/mmt_trading.css" />
<link rel="stylesheet" href="<%=path %>/include/JQuery ui/select2/css/select2.min.css" type="text/css"></link>

<script type="text/javascript" src="<%=path %>/include/js/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="<%=path %>/include/js/icss.shop.manage.js"></script>
<script type="text/javascript" src="<%=path %>/include/js/cookies.js"></script>
<script type="text/javascript" src="<%=path%>/include/JQuery zTree v3.4/js/jquery.ztree.core-3.4.js"></script>
<script type="text/javascript" src="<%=path%>/include/JQuery zTree v3.4/js/jquery.ztree.excheck-3.4.js"></script>
<script type="text/javascript" src="<%=path %>/include/js/icss.common.js"></script>
<script type="text/javascript" src="<%=path %>/include/sweetalert/sweetalert.min.js"></script>
<script type="text/javascript" src="<%=path %>/include/sweetalert/sweetalert-dev.js"></script>
<script type="text/javascript" src="<%=path %>/include/JQuery ui/select2/js/select2.min.js"></script>

	<link rel="stylesheet" href="<%=path%>/include/layui/css/layui.css"  media="all">
    <script type="text/javascript" src="<%=path %>/include/layui/lay/dest/layui.all.js" charset="utf-8"></script>
	
<style type="text/css">
body{}
table{border-collapse: collapse;}
tr{ 
    display:block; /*将tr设置为块体元素*/ 
    margin:10px;  /*设置tr间距为2px*/ 
    width:100%;
}
td{padding:2px;height:30px; line-height:30px;}
.td1{
	width:120px;
	font-size:14px;
	text-align:right;
	vertical-align: middle;
}
.td_1{
	width: 140px;
}
.input1{
	width:300px;
	height:30px;
	line-height:30px;
	vertical-align:middle;
	float:left;
}
#btnDiv a{
   color:black;
}
#btnDiv a:hover{
   color:white;
}
button{
    width:44px;
    height:24px;
    line-height:24px;   
    background-color: transparent;
    background-repeat: no-repeat;
    background-position: 0 -203px;
    border:0;
    cursor:pointer;
    font: 12px/1.5 arial,tahoma,\5b8b\4f53;
    margin: 0 0 0 5px;
    outline:none;
    background-image: url('<%=path%>/include/css/img/xs_bgx.png');   
}
.promptBox{display:inline-block;height:30px;padding-left:5px;width:200px;white-space:nowrap; z-index:50; position:relative;}
.tips-errow{background-position:-296px -22px;color:#f52c2c;}
.tips-ok{background-position:-296px 14px;color:#666;}
.tipsCur{background-position:-296px -55px;color:#666;}
.approveDiv{width:100%;height:23px;margin:0 20px;;padding:15px 0 10px 0;border-bottom: 1px solid #ADADAD;color:blue;}
.select1{
	width: 196px;
    height: 30px;
}
.select2{
    height: 30px;
}
.ps tr{
	margin: 0px;
}
</style>
<script type="text/javascript">
	
	function saveShop(){
		if(_checkAllReady()){
			$.ajax({
	              cache: true,
	              type: "POST",
	              url:'<%=path%>/shopManage/saveShop.do?approveStatus='+$("#approveStatus").val(),
	              data:$('#fm').serialize(),
	              async: false,
	              dataType:'json',
	              error: function(request) {
	                 parent.swal("", "提交失败!", "error");
	              },
	              success: function(data) {
					var msg = data.msg;
					msg = $.trim(msg);
	                if(data.success){
						parent.swal("", msg, "success");
					}else {
						parent.swal("", msg, "error");
					}
	              }
	         });
		}
	}
	
	function hideMenu() {
		$("#menuContent").fadeOut("fast");
		$("body").unbind("mousedown", onBodyDown);
	}
	
	function onBodyDown(event) {
		if (!(event.target.id == "menuBtn" || event.target.id == "menuContent" || $(event.target).parents("#menuContent").length>0)) {
			hideMenu();
		}
	}
	
	function showMenu() {
		var cityObj = $("#citySel");
		var cityOffset = $("#citySel").offset();
		$("#menuContent").css({left:cityOffset.left + "px", top:cityOffset.top + cityObj.outerHeight() + "px"}).slideDown("fast");
		$("body").bind("mousedown", onBodyDown);
	}
	
	//去申请首页展示
	function toApplyHomeDisplayPage(){
		window.location.href="<%=path%>/shopManage/toApplyHomeDisplayPage.do#top";
	}
	function _changeProvince(){
		var areaCode = $('#ProvinceCode option:selected').val();
		var cityCode = "<c:out value='${shopInfo.BANK_CITY}'/>";
		var ifzxs = $('#ProvinceCode option:selected').attr('class');
		if(ifzxs=="0"){
			$.ajax({
	              cache: true,
	              type: "POST",
	              url:'<%=path%>/storeApplyAction/queryProvinceCityList.do.do',
	              data:{areaPcode : areaCode},
	              async: false,
	              dataType : 'json',
	              error: function(request) {
	              },
	              success: function(data) {
	              	 if(data.success){
	              	 	var list = data.obj;
	              	 	if(list.length>0){
							$("#cityCode").empty();
							for(var i =0 ;i<list.length;i++){
								var info = list[i];
								var AREA_CODE = info.AREA_CODE;
								var AREA_NAME = info.AREA_NAME;
								var AREA_PCODE = info.AREA_PCODE;
								var IF_ZXS = info.IF_ZXS;
								if(areaCode==AREA_PCODE){
									var selected = "";
									if(cityCode == AREA_CODE){
										selected = "selected";
									}
									$("#cityCode").append("<option value='"+AREA_CODE+"' "+selected+" >"+AREA_NAME+"</option>");
								}
							}
							$("#cityCode").show();
						}
	              	 }
	              }
	        })
			
		}
	}
	function _statementInfo(){
		$(window.parent.document).find("#rightFrame").height(600);
    	var url = "<%=path%>/pages/storeApply/statement.jsp";
    	parent.layer.open({
  			title: '',
  			type: 2, 
  			area: ['800px', '500px'],
  			content: [url,'no'], //这里content是一个URL，如果你不想让iframe出现滚动条，你还可以content: [url, 'no']
  			end:function(){
  				_reHeight();
  				$("#statement").attr("checked",'true');
  			}
		});
    }
	function _changePro(obj,id,level){
		if(obj.value==""){
			$("#"+id).empty();
			$("#"+id).hide();
			$("#shopCounty").empty();
			$("#shopCounty").hide();
			return;
		}
		$.ajax({
              cache: true,
              type: "POST",
              url:'<%=path%>/storeApplyAction/queryProvinceCityList.do',
              data:{areaPcode : obj.value,level:level},
              async: false,
              dataType : 'json',
              error: function(request) {
              },
              success: function(data) {
              	 if(data){
              	 	var list = data;
              	 	if(list.length>0){
						$("#"+id).empty();
						$("#shopCounty").empty();
						$("#shopCounty").hide();
						for(var i =0 ;i<list.length;i++){
							var info = list[i];
							var AREA_NAME = info.AREA_NAME;
							var AREA_CODE = info.AREA_CODE;
							$("#"+id).append("<option value='"+AREA_CODE+"'>"+AREA_NAME+"</option>");
						}
						$("#"+id).show();
					}
              	 }
              }
        });
	}
	function _updatePage(flag){
		var url = "<%=path%>/storeApplyAction/getStorePage.do?showFlag=1&shopId="+$("#shopId").val();
		if(flag == "1") url += "&shopStatus=0";
		else if(flag == "2") url += "&shopStatus=1";
		else url += "&shopStatus=2";
		window.location.href = url;
	}
	function _setPayType(){
		var type = '${shopInfo.PAY_TYPE}';
		$("[name='payType1']").each(function(){ 
			var val = $(this).val();
			if(type.indexOf(val)>=0) $(this).attr("checked",'true');
		});
	}
	$(function(){_setPayType()});
</script>
</head>
<body style="font-family: '微软雅黑'">
	<div id="contentDiv" style="padding:5px; width:99%;">
		<div style="width:100%;height:30px;border-bottom:1px solid #ADADAD;">
			<div class="toptil">店铺信息</div>
		</div>
		<form id="fm" name="fm" class="form-horizontal form-validate" method="post" action="" novalidate="novalidate">
			<input type="hidden" id="shopId" name="shopId" value="${shopInfo.SHOP_ID }">
			<input type="hidden" id="curPath" name="curPath" value="<%=path %>">
			<div style="width:100%;margin-top:20px;margin-left:10px;">
				<div style="width: 96%;color: red;text-align: right;font-size: 18px;">审核状态：${shopInfo.REGISTER_STATUS }</div>
				<c:if test="${shopInfo.REGISTER_STATUS eq '审核未通过' }">
					<div style="width: 99%;text-align: left;font-size: 14px;">未通过原因：${shopInfo.UNAPPROVE_REASON }</div>
				</c:if>
				<table style="width:100%;">
					<tr style="background: #f5f5f5;margin: 10px 0px;">
						<td class="td1" colspan="2" style="font-size: 18px;">基础信息</td>
					</tr>
					<tr>
						<td class="td1" nowrap>店铺名称：</td>
						<td class="rightTd" nowrap>
							${shopInfo.SHOP_NAME }
						</td>
					</tr>
					<tr>
						<td class="td1" nowrap>法人姓名：</td>
						<td class="rightTd" nowrap>
							${shopInfo.LEGAL_PERSON }
						</td>
					</tr>
					<tr>
						<td class="td1" style="vertical-align:top;white-space: nowrap;">店铺地址：</td>
						<td class="rightTd">
							<c:forEach items="${provinceList}" var="province" > 
								<c:if test="${province.AREA_CODE eq shopInfo.SHOP_PROVINCE}">${province.AREA_NAME }</c:if>
							</c:forEach>
							-
							<c:forEach items="${cityList}" var="city" > 
								<c:if test="${city.AREA_CODE eq shopInfo.SHOP_CITY}">${city.AREA_NAME }</c:if>
							</c:forEach>
							-
							<c:forEach items="${countyList}" var="county" > 
								<c:if test="${county.AREA_CODE eq shopInfo.SHOP_COUNTY}">${county.AREA_NAME }</c:if>
							</c:forEach>
						</td>
					</tr>
					<tr>
						<td class="td1" style="vertical-align:top;white-space: nowrap;">详细地址：</td>
						<td class="rightTd" nowrap>
							${shopInfo.SHOP_ADDRESS }
						</td>
					</tr>
					<tr>
						<td class="td1" nowrap>店铺电话：</td>
						<td class="rightTd" nowrap>
							${shopInfo.SHOP_TEL }
						</td>
					</tr>
					<tr>
						<td class="td1" nowrap style="vertical-align:top;">店铺图片：</td>
						<td class="rightTd" nowrap>
							<div id="shopLogoDiv" style="float:left;margin-right:10px;text-align:center;">
								<div id="imgDiv3" style="margin-bottom:10px;">
									<img src="${shopInfo.SHOP_LOGO }" onerror="javascript:this.src='<%=path%>/download/error/nopicture.jpg'"
										id="imgView1" style="height: 75px; width: 100px;">
								</div>
								<div style="text-align:center;margin:0 18px;font-size:14px;">
									店铺logo
								</div>
							</div>
							<div id="shopPicDiv" style="float:left;text-align:center;">
								<div id="imgDiv4" style="margin-bottom:10px;">
									<img src="${shopInfo.SHOP_PIC }" onerror="javascript:this.src='<%=path%>/download/error/nopicture.jpg'"
										id="imgView1" style="height: 75px; width: 100px;">
								</div>
								<div style="text-align:center;margin:0 18px;font-size:14px;">
									宣传图片
								</div>
							</div>
						</td>
					</tr>
					<tr>
						<td class="td1" nowrap style="vertical-align:top;">店铺详情：</td>
						<td class="rightTd" style="padding-right: 300px">${shopInfo.SHOP_DESC }</td>
					</tr>
					<tr>
						<td class="td1"  nowrap style="vertical-align:top;">身份证：</td>
						<td class="rightTd" id="td1" nowrap>
							<div id="idcardDiv" style="float:left;margin-right:10px;text-align:center;">
								<div id="imgDiv1" style="margin-bottom:0px;">
									<img src="${shopInfo.IDCARD_NO_PIC_F }" onerror="javascript:this.src='<%=path%>/download/error/nopicture.jpg'"
										id="imgView1" style="height: 75px; width: 100px;">
								</div>
								<div style="text-align:center;margin:0 18px;font-size:14px;">
									正面照
								</div>
								<input id="idcardF" name="idcardF" type="hidden" value="${shopInfo.IDCARD_NO_PIC_F }">
							</div>
							<div style="float:left;text-align:center;">
								<div id="imgDiv2" style="margin-bottom:0px;">
									<img src="${shopInfo.IDCARD_NO_PIC_B }" onerror="javascript:this.src='<%=path%>/download/error/nopicture.jpg'"
										id="imgView2" style="height: 75px; width: 100px;">
								</div>
								<div style="text-align:center;margin:0 18px;font-size:14px;">
									反面照
								</div>
								<input id="idcardB" name="idcardB" type="hidden" value="${shopInfo.IDCARD_NO_PIC_B }">
							</div>
						</td>
					</tr>
					<tr>
						<td class="td1">&nbsp;</td>
						<td style="">
							<div id="btnDiv">
								<a onclick="_updatePage('1');" class="btn btn-primary" style="text-decoration:none;color: #fff">修改</a>
							</div>
						</td>
					</tr>
				</table>
				<div style="height: 10px;background: #f5f5f5;width: 100%;display:none;"></div>
				<table style="width:100%;">
					<tr style="background: #f5f5f5;margin: 10px 0px;">
						<td class="td1" colspan="2" style="font-size: 18px;">经营信息</td>
					</tr>
					<tr>
						<td class="td1" nowrap style="vertical-align:top;">经营区域：</td>
						<td class="rightTd" style="padding-right: 300px">
							${areaName}
						</td>
					</tr>
					<tr>
						<td class="td1"  nowrap style="vertical-align:top;">营业执照：</td>
						<td class="rightTd" id="td1" nowrap>
							<div id="businessLicenseDiv" style="float:left;margin-right:10px;text-align:center;">
								<div id="imgDiv5" style="margin-bottom:0px;">
									<img src="${shopInfo.BUSINESS_LICENSE }" onerror="javascript:this.src='<%=path%>/download/error/nopicture.jpg'"
										id="imgView2" style="height: 75px; width: 100px;">
								</div>
								<div style="text-align:center;margin:0 18px;font-size:14px;">
									营业执照
								</div>
							</div>
						</td>
					</tr>
					<tr>
						<td class="td1" nowrap style="vertical-align:top;">经营范围：</td>
						<td class="rightTd" style="padding-right: 300px">
							${shopInfo.BUSINESS_SCOPE }
						</td>
					</tr>
					<tr>
						<td class="td1" nowrap style="vertical-align:top;">店铺坐标：</td>
						<td class="rightTd" nowrap style="padding: 0px;">
							<table>
								<tr style="margin: 0px;">
									<td class="td_1">经度：${shopInfo.LONGITUDE }&nbsp;</td>
									<td class="td_1">纬度：${shopInfo.LATITUDE }&nbsp;</td>
								</tr>
							</table>
							<div id="container" tabindex="0" style="width: 400px;height: 200px;display: none;"></div>
						</td>
					</tr>
					<tr>
						<td class="td1" nowrap style="vertical-align:top;">是否允许发快递：</td>
						<td class="rightTd" nowrap>
							<c:choose>
								<c:when test="${shopInfo.IS_EXPRESS_DELIVERY eq '1' }">是&nbsp;</c:when>
								<c:otherwise>否&nbsp;</c:otherwise>
							</c:choose>
						</td>
					</tr>
					<tr>
						<td class="td1" nowrap style="vertical-align:top;">是否急速达：</td>
						<td class="rightTd" nowrap>
							<c:choose>
								<c:when test="${shopInfo.IF_HURRY_UP eq '1' }">是&nbsp;</c:when>
								<c:otherwise>否&nbsp;</c:otherwise>
							</c:choose>
						</td>
					</tr>
					<tr id="ifHurryUpTr" <c:if test="${shopInfo.IF_HURRY_UP eq '0' }">style="display: none;"</c:if>>
						<td class="td1" nowrap style="vertical-align:top;"> </td>
						<td class="rightTd" nowrap style="padding: 0px;">
							<table>
								<tr style="margin: 0px;">
									<td class="td_1">范围：${shopInfo.HURRY_UP_AREA }&nbsp;米</td>
									<td class="td_1">配送费：${shopInfo.HURRY_UP_FEE }&nbsp;元</td>
									<td class="td_1">配送时间：${shopInfo.JSD_MINUTE }&nbsp;分钟</td>
								</tr>
							</table>
							<div style="font-size: 12px;color: #777;margin-top: 5px;display: none;">急速达：需在<span style="color: red;font-size: 14px;font-weight: bold;">15分钟内</span>送达，并客户签收</div>
						</td>
					</tr>
					<tr>
						<td class="td1" nowrap style="vertical-align:top;">配送范围：</td>
						<td class="rightTd" nowrap style="padding: 0px;">
							<table id="deliveryId" class="ps">
								<tr id="jsdTr" <c:if test="${shopInfo.IF_HURRY_UP eq '0' }">style="display: none;"</c:if>>
									<td class="td_1">范围：${shopInfo.HURRY_UP_AREA }&nbsp;米</td>
									<td class="td_1">配送费：${shopInfo.HURRY_UP_FEE }&nbsp;元</td>
									<td class="td_1">配送时间：${shopInfo.JSD_MINUTE }&nbsp;分钟</td>
								</tr>
								<c:forEach items="${deliveryFeeList }" var="item" varStatus="status">
									<tr>
										<td class="td_1">范围：${item.DELIVERY_AREA }&nbsp;米</td>
										<td class="td_1">配送费：${item.DELIVERY_FEE }&nbsp;元</td>
										<td class="td_1">配送时间：${item.DELIVERY_HOUR }&nbsp;小时</td>
									</tr>
								</c:forEach>
							</table>
						</td>
					</tr>
					<tr>
						<td class="td1" nowrap style="vertical-align:top;">支付方式：</td>
						<td class="rightTd" nowrap>
							<input type="hidden" name="payOnline" id="payOnline" value="${shopInfo.PAY_ONLINE }"/>
							<input type="checkbox" name="payOnline1" value="2" disabled="disabled" <c:if test="${shopInfo.PAY_ONLINE eq '1' or shopInfo.PAY_ONLINE eq '2'}">checked</c:if> />在线支付&nbsp;
							<input type="checkbox" name="payOnline1" value="1" disabled="disabled" <c:if test="${shopInfo.PAY_ONLINE eq '0' or shopInfo.PAY_ONLINE eq '2'}">checked</c:if> />现金支付&nbsp;
						</td>
					</tr>
					<tr id="payTypeTr" <c:if test="${shopInfo.PAY_ONLINE eq '0'}"> style="display: none;"</c:if>>
						<td class="td1" nowrap style="vertical-align:top;"> </td>
						<td class="rightTd" nowrap>
							<input type="hidden" name="payType" id="payType" value="${shopInfo.PAY_TYPE}"/>
							<input type="checkbox" name="payType1" disabled="disabled" value="01"/>储蓄卡&nbsp;
							<input type="checkbox" name="payType1" disabled="disabled" value="02"/>信用卡&nbsp;
							<input type="checkbox" name="payType1" disabled="disabled" value="03"/>微信&nbsp;
							<!-- <input type="checkbox" name="payType1" disabled="disabled" value="04"/>支付宝&nbsp; -->
						</td>
					</tr>
					<tr>
						<td class="td1" nowrap>起送金额：</td>
						<td class="rightTd" nowrap>
							${shopInfo.START_MONEY }
						</td>
					</tr>
					<tr>
						<td class="td1" nowrap><input type="checkbox" checked="checked" id="statement" name="statement" disabled/> </td>
						<td class="rightTd" nowrap style="color: #999">
							已阅读并同意<a class="acss" onclick="_statementInfo()" style="color: #4b8cf7;">《徽映优选供应商入驻协议》</a>
						</td>
					</tr>
					<tr>
						<td class="td1">&nbsp;</td>
						<td style="">
							<div id="btnDiv">
								<a onclick="_updatePage('2');" class="btn btn-primary" style="text-decoration:none;color: #fff">修改</a>
							</div>
						</td>
					</tr>
				</table>
				<div style="height: 10px;background: #f5f5f5;width: 100%;display:none;"></div>
				<table style="width:100%;">
					<tr style="background: #f5f5f5;margin: 10px 0px;width: 100%">
						<td style="font-size: 18px;width: 100%;display: table;line-height: 34px;">
							<div style="width: 104px;text-align: right;float: left;">结算信息</div>
							<div style="color: blue;width: 200px;float: right;"></div>
						</td>
					</tr>
					<tr>
						<td class="td1" nowrap>开户银行：</td>
						<td class="rightTd" nowrap>
							<c:forEach items="${bankList}" var="bank" > 
								<c:if test="${bank.BANK_CODE eq shopInfo.BANK_CODE }">
									${bank.BANK_NAME }
								</c:if>
							</c:forEach>
						</td>
					</tr>
					<tr>
						<td class="td1" nowrap>开户银行城市：</td>
						<td class="rightTd" nowrap>
							<c:forEach items="${provinceList}" var="province" > 
								<c:if test="${province.AREA_CODE eq shopInfo.BANK_PROVINCE and province.LEVEL eq '2' }">
									${province.AREA_NAME }
								</c:if>
							</c:forEach>
							-
							<c:forEach items="${bankCityList}" var="city" > 
								<c:if test="${city.AREA_CODE eq shopInfo.BANK_CITY}">${city.AREA_NAME }</c:if>
							</c:forEach>
						</td>
					</tr>
					<tr>
						<td class="td1" nowrap>开户人姓名：</td>
						<td class="rightTd" nowrap>
							${shopInfo.BANK_ACCOUNT_NAME }
						</td>
					</tr>
					<tr>
						<td class="td1" nowrap>对公账户：</td>
						<td class="rightTd" nowrap>
							${shopInfo.BANK_ACCOUNT }
						</td>
					</tr>
					<c:if test="${statusName ne '' }">
					<tr>
						<td class="td1" nowrap>更改状态：</td>
						<td class="rightTd" nowrap>
							${statusName }
						</td>
					</tr>
					</c:if>
					<tr>
						<td class="td1" >&nbsp;</td>
						<td style="">
							<!-- <button  type="button" onclick="saveShop()">保存</button>
							<button  type="button" style="width:88px;background-size:300px 458px; " onclick="toApplyHomeDisplayPage();">申请首页展示</button>
							 -->
							<div id="btnDiv" style="float: left;">
								<a onclick="_updatePage('3');" class="btn btn-primary" style="text-decoration:none;color: #fff">修改</a>
							</div>
							<div id="btnDiv" style="float: left;padding-left: 20px;display:none;">
								<a onclick="toApplyHomeDisplayPage();" class="btn btn-primary" style="text-decoration:none;color: #fff">申请首页展示</a>
							</div> 
						</td>
					</tr>
				</table>
			</div>
		</form>
	</div>
</body>
<script type="text/javascript">
layui.use('upload', function(){
	 layui.upload({
	  	url: '<%=path%>/upload/uploadPic'
	   	,elem: '#test' //指定原始元素，默认直接查找class="layui-upload-file"
		,title:'店铺logo'
	    //,method: 'post' //上传接口的http类型
	    ,success: function(res){
	       	$("#shopLogo").val(res.url);
			$("#imgView3").attr("src", res.url);
	    }
	 });
	 layui.upload({
	  	url: '<%=path%>/upload/uploadPic'
	   	,elem: '#tes' //指定原始元素，默认直接查找class="layui-upload-file"
	   	,title:'宣传图片'
	    //,method: 'post' //上传接口的http类型
	    ,success: function(res){
	       	$("#shopPic").val(res.url);
			$("#imgView4").attr("src", res.url);
	    }
	 });
});
</script>
 <script type="text/javascript">
  	var zTree = null;
  	$(document).ready(function(){
		_reHeight();
		zTree = $.fn.zTree.init($("#treeDemo"), treeSetting);
		
		$("#bankCode").select2();
	});
	function _reHeight(){
		var main = $(window.parent.document).find("#rightFrame");
		var mainheight = $("#contentDiv").height();
		main.height(mainheight);
	}
  	
	/* 
	 * 下拉树的设置 
	 */  
	var treeSetting = {  
	    view: {  
	        dblClickExpand: false  
	    },  
		data: {  
			simpleData: {  
			    enable: true,
			    rootPId: 0
			}  
		},
		check: {  
			enable: true,
			autoCheckTrigger:true
		}, 
		async:{
			enable: true,//设置ztree是否开启异步加载模式
			showLine: true ,//设置是否显示连接线
			type: "post",//post方式请求数据
			url: getUrl,//数据请求url
			autoParam:["id","name"],//异步加载时需要自动提交父节点属性的参数
			otherParam:{"otherParam":"zTreeAsyncTest"},
			dataFilter: filter
		},
		callback: {
			beforeClick: beforeClick,
			onCheck: onCheck,
			onAsyncError : zTreeOnAsyncError,//加载失败
			onAsyncSuccess: zTreeOnAsyncSuccess//加载完成
		}
	}; 
	
	function getUrl(treeId, treeNode){
		var shopId = $("#shopId").val();
		var url = "<%=path %>/shopManage/getTree.do?shopId=" + shopId;
		return url;
	}
	
	function beforeClick(treeId, treeNode) {
		var zTree = $.fn.zTree.getZTreeObj("treeDemo");
		zTree.checkNode(treeNode, !treeNode.checked, null, true);
		return false;
	}
	
	/* 
	 * 点击事件 
	 */  
	function onCheck(e, treeId, treeNode) {  
		
		var cityObj = $("#citySel");
		var shopAreaObj = $("#shopArea");
	    var zTree = $.fn.zTree.getZTreeObj("treeDemo");
		var nodes = zTree.getCheckedNodes(true);
		var changeNodes = zTree.getChangeCheckedNodes();
		var v = '';
		var ids = '';
		for (var i=0, l=nodes.length; i<l; i++) {
			if(!nodes[i].isParent){
				v += nodes[i].aname + ",";
				ids += nodes[i].id + ",";
			}
		}
		if (v.length > 0 ) v = v.substring(0, v.length-1);
		if (ids.length > 0 ) ids = ids.substring(0, ids.length-1);
		cityObj.attr("value", v);
		shopAreaObj.attr("value", ids);
	}  
	//过滤函数  
    function filter(treeId, parentNode, childNodes) {  
        if (!childNodes)  
            return null;  
        for ( var i = 0, l = childNodes.length; i < l; i++) {  
            //childNodes[i].name = childNodes[i].name.replace(/\.n/g, '.');  
        }  
        return childNodes;  
    }  
    //加载完成
	var firstAsyncSuccessFlag = 0;
	function zTreeOnAsyncSuccess(event, treeId, msg) {
		if (firstAsyncSuccessFlag == 0) {
        	try {
				//调用默认展开第一个结点
			//	var nodes = zTree.getNodes();
			//	zTree.expandNode(nodes[0], true);
			//	for(var i = 0; i< nodes.length; i++){
			//		zTree.expandNode(nodes[i], true);
			//	}
			//	$("#treeDemo").click();
	            
	            //异步加载完成再折叠所有子节点
	            var nodes = zTree.getNodes();
				if (nodes.length>0) {
					var index = zTree.getNodeIndex(nodes[0]);
					for(var j=0; j<nodes.length; j++){
						var rootNode = nodes[j];
						zTree.expandNode(rootNode, false, true, null, true);
					}
				}
	            
	            firstAsyncSuccessFlag = 1;
        	} catch (err) {
	              
         	}
    	}
	}
	//加载失败提示  
    function zTreeOnAsyncError(event, treeId, treeNode, XMLHttpRequest, textStatus, errorThrown) {  
        parent.swal("", "经营区域加载失败，请稍后再试", "info");
    }; 
  </script>
</html>
